<template>
	<yplayout v-if="isLoad">
		<template #header="props">
			<div class="flex items-center">
				<i class="ri-2x text-gray-500 ml-2" :class="props.meta.icon || 'ri-information-line'"></i>
				<div class="text-xl px-2">企业信息查看</div>
			</div>
		</template>
		<template #list>
			<div class="text-sm p-5">
				<div class="grid grid-cols-3 gap-x-5 gap-y-3 border p-3 rounded-md">
					<div class="flex items-center">
						<div class="w-32 text-right text-hui-200">企业名称：</div>
						<div class="text-base">{{ r.name }}</div>
					</div>
					<div class="flex items-center">
						<div class="w-32 text-right text-hui-200">法人：</div>
						<div class="text-base">{{ r.legal }}</div>
					</div>
					<div class="row-span-5">
						<div class="space-y-2 flex flex-col items-center">
							<img
									class="w-32 min-h-[90px]"
									:class="r.thumbFile ? 'cursor-pointer' : ''"
									:src="r.thumbFile"
									@click="r.thumbFile ? imgPreview([r.thumbFile]) : ''"
								/>
								<p>营业执照</p>
						</div>
					</div>
					<div>
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">联系人：</div>
							<div class="text-base">{{ r.contact }}</div>
						</div>
					</div>
					<div>
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">联系电话：</div>
							<div class="text-base">{{ r.phone }}</div>
						</div>
					</div>

					<div>
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">门店数量：</div>
							<div class="text-base">{{ r.totalstores }}</div>
						</div>
					</div>
					<div>
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">截止日期：</div>
							<div class="text-base">{{ r.endtime }}</div>
						</div>
					</div>
					<div class="col-span-2">
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">公司地址：</div>
							<div class="text-base">{{ r.areaName }}{{ r.address }}</div>
						</div>
					</div>
					<div class="col-span-2">
						<div class="flex items-center">
							<div class="w-32 text-right text-hui-200">备注：</div>
							<div class="text-base">{{ r.intro }}</div>
						</div>
					</div>
				</div>
			</div>
			<div class="flex justify-center py-3 space-x-2">
				<button class="btn" type="button" @click="router.push('list')">
					<i class="ri-arrow-go-back-line ri-lg pr-1"></i>
					返回
				</button>
			</div>
		</template>
	</yplayout>
</template>
<script setup>
	import { useRoute, useRouter } from 'vue-router'
	import { onMounted, ref,reactive } from 'vue'
	import { getData } from '@/common/base'
	import { imgPreview } from '@/components/utils'
	const route = useRoute()
	const router = useRouter()
	const id = route.query.id
	const isLoad = ref(false)
	const r = ref({})
	const read = async () => {
		const resp = await getData('company/read', {id:id})
		if (resp.code == 1) {
			r.value = resp.data
			isLoad.value = true
		}
	}


	onMounted(async() => {
		if (id) {
			await read()
		}
	})

</script>
